Skip to content

MINOR: Cleanup Trogdor Module #20214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 7, 2025

Conversation

sjhajharia
Copy link
Contributor

@sjhajharia sjhajharia commented Jul 22, 2025

Now that Kafka support Java 17, this PR makes some changes in trogdor
module. The changes mostly include:

  • Collections.emptyList(), Collections.singletonList() and
    Arrays.asList() are replaced with List.of()
  • Collections.emptyMap() and Collections.singletonMap() are replaced
    with Map.of()
  • Collections.singleton() is replaced with Set.of()

Some minor cleanups around use of enhanced switch blocks and conversion
of classes to record classes.

Reviewers: Ken Huang s7133700@gmail.com, Vincent Jiang
vpotucek@me.com, Chia-Ping Tsai chia7712@gmail.com

@github-actions github-actions bot added triage PRs from the community tools labels Jul 22, 2025
Copy link
Collaborator

@m1a2st m1a2st left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sjhajharia for this patch, left some comments

@sjhajharia
Copy link
Contributor Author

sjhajharia commented Jul 22, 2025

Thank you @m1a2st and @Pankraz76 for the reviews. I have addressed them.
Requesting a re-review when possible.
TIA!

@sjhajharia sjhajharia requested review from m1a2st and Pankraz76 July 22, 2025 16:35
@JsonCreator
public ErrorResponse(@JsonProperty("code") int code,
@JsonProperty("message") String message) {
this.code = code;
this.message = message;
}

@Override

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nicely done, thanks. Until taken care by plugin it can happen anytime leaving this task kind of open. Offering to apply thins kind of conventions via rewrite.

@github-actions github-actions bot removed the triage PRs from the community label Jul 23, 2025
@sjhajharia
Copy link
Contributor Author

Adding @chia7712 for review
TIA.

@JsonCreator
public TaskRequest(@JsonProperty("taskId") String taskId) {
this.taskId = taskId == null ? "" : taskId;
}

@Override
@JsonProperty
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the name taskId is same as the method name, so are those annotations really necessary?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

considering Override kind of best practice, it should not do any harm.

Can not tell anything about JsonProperty, except of assuming its needed by the business case, therefore covered by some test, or it can be removed/challenged.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @chia7712 , I agree, both of the annotations are unnexcessary. Dropped them.
Pls re-review. TIA!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the inspiration. False positive(s) should be covered as well.

Copy link
Member

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sjhajharia thanks for this patch. I have left a couple of comments.

@@ -84,7 +83,9 @@ public List<Integer> partitionNumbers() {
}
return partitionNumbers;
} else {
return new ArrayList<>(partitionAssignments.keySet());
ArrayList<Integer> partitionNumbers = new ArrayList<>(partitionAssignments.keySet());
partitionNumbers.sort(Integer::compareTo);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it being sorted?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was done because TopicsSpecTest.testPartitionNumbers became flaky after the changes. Upon further consideration, I re-did the test rather than add a complexity here.

@sjhajharia
Copy link
Contributor Author

Thank you @chia7712 for the review. I have addressed the same.

@sjhajharia sjhajharia requested a review from chia7712 August 7, 2025 04:29
@chia7712 chia7712 merged commit cfe483b into apache:trunk Aug 7, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants